-
Notifications
You must be signed in to change notification settings - Fork 48
Add disk_offering & override_disk_offering to instance resource #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add disk_offering & override_disk_offering to instance resource #208
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for disk offering configuration in CloudStack instance resources by introducing two new optional parameters: disk_offering
and override_disk_offering
. These fields allow users to specify disk offerings for virtual machines when deploying from templates or ISO images.
Key changes:
- Added two new optional fields to the instance resource schema with ForceNew behavior
- Implemented parameter handling in the instance creation logic
- Added documentation for the new fields explaining their usage with templates vs ISO images
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
website/docs/r/instance.html.markdown |
Added documentation for the new disk_offering and override_disk_offering parameters |
cloudstack/resource_cloudstack_instance.go |
Added schema definitions and creation logic for the new disk offering fields |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Tested manually
resource "cloudstack_instance" "web" {
name = "server-1"
service_offering = "6bf9d0ab-49fd-4bae-937b-286f54532474"
network_id = "1eb73b50-1db5-42f5-8938-8592df101d61"
template = "CentOS 5.5(64-bit) no GUI (KVM)"
zone = "ref-trl-9219-k-Mol8-kiran-chavala"
disk_offering = "2c8a9190-3099-4598-95b1-19560bd40210"
override_disk_offering = "90383b87-f8f9-419a-8b90-4e0a03898c25"
}
terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# cloudstack_instance.web will be created
+ resource "cloudstack_instance" "web" {
+ disk_offering = "2c8a9190-3099-4598-95b1-19560bd40210"
+ display_name = (known after apply)
+ expunge = false
+ group = (known after apply)
+ id = (known after apply)
+ ip_address = (known after apply)
+ name = "server-1"
+ network_id = "1eb73b50-1db5-42f5-8938-8592df101d61"
+ override_disk_offering = "90383b87-f8f9-419a-8b90-4e0a03898c25"
+ project = (known after apply)
+ root_disk_size = (known after apply)
+ service_offering = "6bf9d0ab-49fd-4bae-937b-286f54532474"
+ start_vm = true
+ tags = (known after apply)
+ template = "CentOS 5.5(64-bit) no GUI (KVM)"
+ uefi = false
+ zone = "ref-trl-9219-k-Mol8-kiran-chavala"
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
cloudstack_instance.web: Creating...
cloudstack_instance.web: Still creating... [00m10s elapsed]
cloudstack_instance.web: Creation complete after 18s [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
╭─ ~/Desktop/cloudstack-India-demo/cloudstack-terraform copy ✔ ╱ 21s ╱ Azure subscription 1 ╱ 03:11:37 PM
╰─ terraform destroy
cloudstack_instance.web: Refreshing state... [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
- destroy
Terraform will perform the following actions:
# cloudstack_instance.web will be destroyed
- resource "cloudstack_instance" "web" {
- disk_offering = "90383b87-f8f9-419a-8b90-4e0a03898c25" -> null
- display_name = "server-1" -> null
- expunge = false -> null
- id = "c132df8e-4e0d-4994-b0c1-ee6167aeae78" -> null
- ip_address = "10.1.1.212" -> null
- name = "server-1" -> null
- network_id = "1eb73b50-1db5-42f5-8938-8592df101d61" -> null
- override_disk_offering = "90383b87-f8f9-419a-8b90-4e0a03898c25" -> null
- root_disk_size = 20 -> null
- service_offering = "6bf9d0ab-49fd-4bae-937b-286f54532474" -> null
- start_vm = true -> null
- tags = {} -> null
- template = "CentOS 5.5(64-bit) no GUI (KVM)" -> null
- uefi = false -> null
- zone = "ref-trl-9219-k-Mol8-kiran-chavala" -> null
# (2 unchanged attributes hidden)
}
Plan: 0 to add, 0 to change, 1 to destroy.
Do you really want to destroy all resources?
Terraform will destroy all your managed infrastructure, as shown above.
There is no undo. Only 'yes' will be accepted to confirm.
Enter a value: yes
cloudstack_instance.web: Destroying... [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78]
cloudstack_instance.web: Still destroying... [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78, 00m10s elapsed]
cloudstack_instance.web: Still destroying... [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78, 00m20s elapsed]
cloudstack_instance.web: Still destroying... [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78, 00m30s elapsed]
cloudstack_instance.web: Still destroying... [id=c132df8e-4e0d-4994-b0c1-ee6167aeae78, 00m40s elapsed]
cloudstack_instance.web: Destruction complete after 48s
Destroy complete! Resources: 1 destroyed.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm
Fixes #68
Changes in these fields is ignored as of now.